#!/usr/bin/bash
#
#  Usage: 自定义CA
#  Issue: 2024-05-17
# Author: Leon Hsia
#   Mail: waxwork3@163.com
#
base_path=$(dirname $(realpath $0))
cd $base_path/pki

openssl req -subj '/C=CN/ST=Zhejiang/L=xxxx/O=Zhejiang xxxx Rural Commercial Bank/CN=Zhejiang xxxx Rural Commercial Bank Root CA' \
	-new -newkey rsa:2048 -sha256 \
	-days 7200 -nodes -x509 -keyout ca.key -out ca.crt 2>/dev/null
openssl x509 -in ca.crt -noout -text |sed '/Modulus/,/Exponent/d;/Value:/,$d'